home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
cit.arc
/
CTDL.C
< prev
next >
Wrap
C/C++ Source or Header
|
1986-01-22
|
28KB
|
1,038 lines
/************************************************************************/
/* ctdl.c */
/* Command-interpreter code for Citadel */
/************************************************************************/
#include "ctdl.h"
#define VERSION "2.07"
/************************************************************************/
/* history */
/* */
/* 85Nov19 HAW Kill visible switch. */
/* 85Nov17 HAW Add <U>ngoto command. */
/* 85Oct16 HAW Add <I> command to sysop menu. */
/* 85Aug31 HAW Fix doLogout to handle carrier loss during confirmation.*/
/* 85Jul06 HAW Add code for crash message in Aide, and .K option. */
/* 85Jul01 HAW Add option to read host files in formatted form. */
/* 85Jun03 HAW Add exit values. */
/* 85Jun03 HAW Put in networking stuff. */
/* 85Feb20 HAW IMPERVIOUS flag implemented. */
/* 85Jan14 HAW doHelp() fixed so no overflows of file names can occur. */
/* 84Sep19 HAW Now all aide functions have some form of CONFIRM. */
/* 84Sep11 HAW SysOp privileges now ^l; ^p filtered by MSDOS. */
/* 84Aug30 HAW And now for the plunge into ... MS-DOS! */
/* 84Aug23 HAW & JLS JLS's Forget scheme implemented. */
/* 84JuL12 HAW & JLS <S>kip implemented. */
/* 84JuL06 HAW ALL FILES: make putChar the bottleneck! */
/* 84Jun26 JLS & HAW Commented out extra params to putRoom & getRoom. */
/* 84Jun21 JLS Fix ".Read" so can't have endless "reverse forward..." */
/* 84Jun10 JLS Implement "user must log in to create room." */
/* 84Jun10 JLS Mod for changing date from other than system console. */
/* 84May18 JLS/HAW Greeting modified for coherency. */
/* 84Apr04 HAW Upgrade to BDS 1.50a begun. */
/* 83Mar08 CrT Aide-special functions installed & tested... */
/* 83Feb24 CrT/SB Menus rearranged. */
/* 82Dec06 CrT 2.00 release. */
/* 82Nov05 CrT removed main() from room2.c and split into sub-fn()s */
/************************************************************************/
/************************************************************************/
/* Contents */
/* */
/* doAide() handles Aide-only commands */
/* doChat() handles C(hat) command */
/* doEnter() handles E(nter) command */
/* doForget() handles Z(Forget room) command */
/* doGoto() handles G(oto) command */
/* doHelp() handles H(elp) command */
/* doKnown() handles K(nown rooms) command */
/* doLogin() handles L(ogin) command */
/* doLogout() handles T(erminate) command */
/* doRead() handles R(ead) command */
/* doRegular() fanout for above commands */
/* doSkip() handles S(kip) command */
/* doSysop() handles sysop-only commands */
/* doUngoto() handles U(ngoto) command */
/* getCommand() prints prompt and gets command char */
/* greeting() System-entry blurb etc */
/* main() has the central menu code */
/************************************************************************/
/************************************************************************/
/* External declarations in CTDL.C */
/************************************************************************/
char ExitToMsdos = FALSE; /* True when time to bring system down */
int exitValue = CRASH_EXIT;
/************************************************************************/
/* External variable definitions for CTDL.C */
/************************************************************************/
extern struct config cfg; /* The main variable to be saved */
extern struct aRoom roomBuf; /* Room buffer */
extern struct msgB msgBuf; /* Message buffer */
extern struct msgB tempMess; /* Message buffer */
extern struct logBuffer logBuf; /* Person's log buffer */
extern struct rTable roomTab[]; /* Room index for RAM */
extern struct lTable *logTab; /* Log index for RAM */
extern long FDSectCount; /* size of files in directory */
extern int thisRoom; /* Current room */
extern long int pulledMLoc; /* Loc of msg to be pulled */
extern ulong pulledMId; /* Id of msg to be pulled */
extern char onConsole; /* Where IO is ... */
extern char whichIO; /* Where IO is ... */
extern char outFlag;
extern char expert; /* User expert? */
extern char aide; /* User aide? */
extern char loggedIn; /* Are we logged in? */
extern char echo;
extern char newCarrier; /* Just got carrier, hurrah! */
extern char justLostCarrier;/* Boo, hiss! */
extern char usingWCprotocol;/* WC protocol flag */
extern char textDownload; /* flag */
extern char haveCarrier;
extern char *baseRoom;
extern int lastRoom; /* For Ungoto command */
extern char heldMess;
extern char anyEcho;
extern int acount;
#define AUDIT 9000
extern char audit[AUDIT];
/************************************************************************/
/* External function definitions for CTDL.C */
/************************************************************************/
char toUpper();
char iChar();
/************************************************************************/
/* doAide() handles the aide-only menu */
/* return FALSE to fall invisibly into default error msg */
/************************************************************************/
char doAide(moreYet, first)
char moreYet;
char first; /* first parameter if TRUE */
{
label oldName;
int rm, roomExist();
char chatStack;
if (!aide) return FALSE;
if (moreYet) first = '\0';
mPrintf("ide special fn: ");
if (first) oChar(first);
switch (toUpper( first ? first : iChar() )) {
case 'C':
chatStack = cfg.noChat;
cfg.noChat = FALSE;
mPrintf("hat\n ");
if (whichIO == MODEM) ringSysop();
else interact() ;
cfg.noChat = chatStack;
break;
case 'D':
sPrintf(msgBuf.mbtext, "The following empty rooms deleted by %s: ",
logBuf.lbname);
mPrintf("elete empty rooms\n ");
if (!getYesNo("confirm"))
break;
strCpy(oldName, roomBuf.rbname);
indexRooms();
if ((rm=roomExist(oldName)) != ERROR) getRoom(rm);
else getRoom(LOBBY);
aideMessage( /* noteDeletedMessage== */ FALSE );
break;
case 'E':
mPrintf("dit room\n \n");
strCpy(oldName, roomBuf.rbname);
if (!renameRoom()) break;
sPrintf(
msgBuf.mbtext,
"%s> edited to %s> by %s",
oldName,
roomBuf.rbname,
logBuf.lbname
);
aideMessage( /* noteDeletedMessage == */ FALSE);
break;
case 'S':
mPrintf("et Date\n ");
changeDate();
break;
case 'I':
mPrintf("nsert message\n ");
if (
thisRoom == AIDEROOM
||
pulledMId == 0l
) {
mPrintf("nope!");
break;
}
if (!getYesNo("confirm"))
break;
note2Message(pulledMId, pulledMLoc);
putRoom(thisRoom);
noteRoom();
sPrintf(
msgBuf.mbtext,
"Following message inserted in %s> by %s",
roomBuf.rbname,
logBuf.lbname
);
aideMessage( /* noteDeletedMessage == */ TRUE);
break;
case 'K':
mPrintf("ill room\n ");
if (
thisRoom == LOBBY
||
thisRoom == MAILROOM
||
thisRoom == AIDEROOM
) {
mPrintf(" not here!");
break;
}
if (!getYesNo("confirm")) break;
sPrintf(
msgBuf.mbtext,
"%s> killed by %s",
roomBuf.rbname,
logBuf.lbname
);
aideMessage( /* noteDeletedMessage == */ FALSE);
roomBuf.rbflags.INUSE = FALSE;
putRoom(thisRoom);
noteRoom();
getRoom(LOBBY);
break;
case '?':
tutorial("aide.mnu");
break;
default:
if (!expert) mPrintf(" ?(Type '?' for menu)\n " );
else mPrintf(" ?\n " );
break;
}
return TRUE;
}
/************************************************************************/
/* doChat() */
/************************************************************************/
doChat(moreYet, first)
char moreYet; /* TRUE to accept following parameters */
char first; /* first parameter if TRUE */
{
if (moreYet) first = '\0';
if (first) oChar(first);
mPrintf("hat ");
if (cfg.noChat) {
tutorial("nochat.blb");
return;
}
if (whichIO == MODEM) ringSysop();
else interact() ;
}
/************************************************************************/
/* doEnter() handles E(nter) command */
/************************************************************************/
doEnter(moreYet, first)
char moreYet; /* TRUE to accept following parameters */
char first; /* first parameter if TRUE */
{
#define CONFIGURATION 0
#define MESSAGE 1
#define PASSWORD 2
#define ROOM 3
#define FILE 4
#define CONTINUED 5
#define NETWORK 6
char what; /* one of above five */
char abort, done, WC;
if (moreYet) first = '\0';
abort = FALSE ;
done = FALSE ;
WC = FALSE ;
what = MESSAGE;
mPrintf("nter ");
if (!loggedIn && !cfg.unlogLoginOk && thisRoom!=MAILROOM) {
mPrintf("--Must log in to enter (except in Mail>)\n ");
return;
}
if (first) oChar(first);
do {
outFlag = OUTOK;
switch (toUpper( first ? first : iChar() )) {
case '\r':
case '\n':
moreYet = FALSE;
break;
case 'F':
if (roomBuf.rbflags.MSDOSDIR == 1) {
mPrintf("ile upload ");
what = FILE;
done = TRUE;
break;
}
default:
mPrintf("? ");
abort = TRUE;
if (expert) break;
case '?':
tutorial("entopt.mnu");
abort = TRUE;
break;
case 'C':
mPrintf("onfiguration ");
what = CONFIGURATION;
done = TRUE;
break;
case 'F':
mPrintf("ile upload " );
WC = TRUE;
done = TRUE;
break;
case 'M':
mPrintf("essage " );
what = MESSAGE;
done = TRUE;
break;
case 'P':
mPrintf("assword " );
what = PASSWORD ;
done = TRUE;
break;
case 'R':
mPrintf("oom " );
if (!cfg.nonAideRoomOk && !aide) {
mPrintf(" ?-- must be aide to create room\n ");
abort = TRUE;
break;
}
if (!loggedIn) {
mPrintf("!Must log in to create a new room\n");
abort = TRUE;
break;
}
what = ROOM;
done = TRUE;
break;
case 'H':
mPrintf("eld Message ");
what = CONTINUED;
done = TRUE;
break;
case 'N':
mPrintf("et-Message ");
what = NETWORK;
done = TRUE;
break;
}
first = '\0';
} while (!done && moreYet && !abort);
doCR();
if (!abort) {
if (whichIO != CONSOLE && thisRoom == MAILROOM) echo = CALLER;
switch (what) {
case CONFIGURATION : configure(loggedIn); break;
case MESSAGE : makeMessage(WC, NULL,
0, FALSE) ; break;
case PASSWORD : newPW() ; break;
case ROOM : makeRoom() ; break;
case FILE : upLoad() ; break;
case CONTINUED : makeMessage(WC, NULL,
1,
tempMess.mbaddr[0]) ; break;
case NETWORK : netMessage() ; break;
}
echo = BOTH;
}
}
/************************************************************************/
/* doForget() handles (Forget room) command */
/************************************************************************/
doForget(expand, first)
char expand, first;
{
int i;
if (!expand) {
mPrintf("\bForget %s \n ", roomBuf.rbname);
if (thisRoom == LOBBY ||
thisRoom == MAILROOM ||
thisRoom == AIDEROOM) {
mPrintf("!Can't forget this room! \n ");
return ;
}
if (!getYesNo("confirm")) return;
i = (roomBuf.rbgen + FORGET_OFFSET) % MAXGEN; /* Set up offset*/
logBuf.lbgen[thisRoom] = i << GENSHIFT; /* Save it */
gotoRoom(baseRoom, 'S');
}
else {
mPrintf("\b\b ");
listRooms(/* doDull == */ FORGOT);
}
}
/************************************************************************/
/* doGoto() handles G(oto) command */
/************************************************************************/
doGoto(expand, first)
char expand; /* TRUE to accept following parameters */
char first; /* first parameter if TRUE */
{
label roomName;
outFlag = IMPERVIOUS;
mPrintf("oto ");
if (!expand) {
gotoRoom("", 'R');
return;
}
getNormStr("", roomName, NAMESIZE, ECHO);
if (roomName[0] == '?') listRooms(/* doDull== */ ALMOST_ALL);
else gotoRoom(roomName, 'R');
}
/************************************************************************/
/* doHelp() handles H(elp) command */
/************************************************************************/
doHelp(expand, first)
char expand; /* TRUE to accept following parameters */
char first; /* first parameter if TRUE */
{
label fileName;
mPrintf("elp ");
if (!expand) {
mPrintf("\n\n");
tutorial("dohelp.hlp");
return;
}
getNormStr("", fileName, 9, ECHO);
if (strLen(fileName) == 0)
strCpy(fileName, "dohelp");
if (fileName[0] == '?') tutorial("helpopt.hlp");
else {
/* adding the extention makes things look simpler for */
/* the user... and restricts the files which can be read */
strCat(fileName, ".hlp");
tutorial(fileName);
}
}
/************************************************************************/
/* doKnown() handles K(nown rooms) command. */
/************************************************************************/
doKnown(expand, first)
char expand; /* TRUE to accept following parameters */
char first; /* first parameter if TRUE */
{
mPrintf("nown rooms ");
if (!expand) {
mPrintf("\n ");
listRooms(/* doDull== */ ALMOST_ALL);
}
else
searchRooms();
}
/************************************************************************/
/* doLogin() handles L(ogin) command */
/************************************************************************/
doLogin(moreYet, first)
char moreYet; /* TRUE to accept following parameters */
char first; /* first parameter if TRUE */
{
label passWord;
mPrintf("ogin ");
if (!moreYet) mPrintf("\n");
if (loggedIn) {
mPrintf("\n ?Already logged in!\n ");
return;
}
echo = CALLER;
getNormStr(moreYet ? "" : " password", passWord, NAMESIZE,
(moreYet) ? ECHO : NO_ECHO);
echo = BOTH;
login(passWord);
}
/************************************************************************/
/* doLogout() handles T(erminate) command */
/************************************************************************/
doLogout(expand, first)
char expand; /* TRUE to accept following parameters */
char first; /* first parameter if TRUE */
{
if (expand) first = '\0';
mPrintf("erminate ");
if (heldMess)
mPrintf("\n WARNING: You have a message in your Hold Message Buffer!\n ");
if (first) oChar(first);
switch (toUpper( first ? first : iChar() )) {
case '?':
mPrintf("\n Logout options:\n \n ");
mPrintf("Quit-also\n " );
mPrintf("Stay\n " );
break;
case 'Q':
mPrintf("uit-also\n ");
if (!expand) {
if (!getYesNo("confirm")) break;
}
if (!onLine()) break;
terminate( /* hangUp == */ TRUE);
break;
case 'S':
mPrintf("tay\n ");
terminate( /* hangUp == */ FALSE);
break;
}
}
/************************************************************************/
/* doRead() handles R(ead) command */
/************************************************************************/
doRead(moreYet, first)
char moreYet; /* TRUE to accept following parameters */
char first; /* first parameter if TRUE */
{
int fDir(), transmitFile(), formatFile();
char abort, doDir, done, hostFile, whichMess, revOrder, status, WC;
char formatted;
label fileName;
if (moreYet) first = '\0';
mPrintf("\bread ");
abort = FALSE;
doDir = FALSE;
hostFile = FALSE;
revOrder = FALSE;
status = FALSE;
WC = FALSE;
formatted = FALSE;
whichMess = NEWoNLY;
if (thisRoom == MAILROOM && !loggedIn && !cfg.unlogReadOk) {
showMessages(whichMess, revOrder);
return;
}
if (!loggedIn && !cfg.unlogReadOk) {
mPrintf("Must log in to read\n ");
return;
}
if (first) oChar(first);
do {
outFlag = OUTOK;
done = TRUE;
switch (toUpper( first ? first : iChar() )) {
case '\n':
case '\r':
moreYet = FALSE;
break;
case 'A':
if (hostFile) break;
mPrintf("ll");
whichMess = OLDaNDnEW;
break;
case 'F':
if (!hostFile) {
mPrintf("orward");
revOrder = FALSE;
whichMess = OLDaNDnEW;
}
else {
mPrintf("ormatted");
formatted = TRUE;
}
break;
case 'G':
if (hostFile) break;
mPrintf("lobal new-messages");
whichMess = GLOBALnEW;
break;
case 'N':
if (hostFile) break;
mPrintf("ew ");
whichMess = NEWoNLY;
break;
case 'O':
if (hostFile) break;
mPrintf("ld Reverse");
revOrder = TRUE;
whichMess = OLDoNLY;
break;
case 'R':
if (hostFile) break;
mPrintf("everse");
revOrder = TRUE;
whichMess = OLDaNDnEW;
break;
case 'S':
if (hostFile) break;
mPrintf("tatus\n ");
status = TRUE;
break;
case 'W':
if (hostFile) break;
mPrintf("C protocol ");
WC = TRUE;
done = FALSE;
break;
case 'B':
if (hostFile) break;
if (roomBuf.rbflags.MSDOSDIR == 1) {
mPrintf("inary file(s) ");
hostFile = TRUE ;
textDownload = FALSE;
break;
}
case 'D':
if (hostFile) break;
if (roomBuf.rbflags.MSDOSDIR == 1) {
mPrintf("irectory ");
doDir = TRUE;
break;
}
case 'T':
if (hostFile) break;
if (roomBuf.rbflags.MSDOSDIR == 1) {
mPrintf("extfile(s) ");
hostFile = TRUE;
textDownload = TRUE;
if (!WC) done = FALSE;
break;
}
default:
mPrintf("? ");
abort = TRUE;
setUp(FALSE);
if (expert) break;
case '?':
tutorial("readopt.mnu");
abort = TRUE;
break;
}
first = '\0';
} while (!done && moreYet && !abort);
if (abort) return;
if (status) {
systat();
return;
}
if (doDir) {
FDSectCount = 0; /* global fDir() totals sectors in */
getNormStr("", fileName, NAMESIZE, ECHO);
if (strLen(fileName)) wildCard(fDir, fileName);
else wildCard(fDir, "*.*" );
mPrintf("\n Approximately %ld sectors total\n ", FDSectCount);
return;
}
if (hostFile) {
getNormStr("afn", fileName, NAMESIZE, ECHO);
usingWCprotocol = WC;
wildCard((formatted) ? formatFile : transmitFile, fileName);
usingWCprotocol = FALSE;
return;
}
doCR();
if (WC) {
download(whichMess, revOrder);
return;
}
if (whichMess != GLOBALnEW) {
showMessages(whichMess, revOrder);
} else {
while (outFlag != OUTSKIP && gotoRoom("", 'R')) {
givePrompt();
mPrintf("read new\n ");
showMessages(NEWoNLY, revOrder);
}
}
}
/************************************************************************/
/* doRegular() */
/************************************************************************/
char doRegular(x, c)
char x, c;
{
char toReturn;
toReturn = FALSE;
switch (c) {
case 'C': doChat( x, '\0'); break;
case 'E': doEnter( x, 'm' ); break;
case 'F': doRead( x, 'f' ); break;
case 'G': doGoto( x, '\0'); break;
case 'H': doHelp( x, '\0'); break;
case 'K': doKnown( x, '\0'); break;
case 'L': doLogin( x, '\0'); break;
case 'N': doRead( x, 'n' ); break;
case 'O': doRead( x, 'o' ); break;
case 'R': doRead( x, 'r' ); break;
case 'S': doSkip( x, '\0'); break;
case 'T': doLogout(x, 'q' ); break;
case 'U': doUngoto(x, '\0'); break;
case 0:
if (newCarrier) {
greeting();
newCarrier = FALSE;
}
if (justLostCarrier) {
justLostCarrier = FALSE;
if (loggedIn) terminate(FALSE);
}
break; /* irrelevant value */
case '?':
tutorial("mainopt.mnu");
if (whichIO == CONSOLE) mPrintf("\n^l: SysOp privileged fns\n ");
break;
case 'A': if (!doAide(x, 'E')) toReturn=TRUE; break;
case 'Z': doForget(x, '\0'); break;
default:
toReturn=TRUE;
break;
}
return toReturn;
}
/************************************************************************/
/* doSkip() handles the <S>kip a room command */
/************************************************************************/
doSkip(expand, first)
char first, expand;
{
label roomName; /* In case of ".Skip" */
outFlag = IMPERVIOUS;
mPrintf("kip %s> goto ", roomTab[thisRoom].rtname);
if (expand)
getNormStr("", roomName, NAMESIZE, ECHO);
else
roomName[0] = '\0';
if (roomName[0] == '?')
tutorial("skip.hlp");
else {
roomTab[thisRoom].rtflags.SKIP = 1; /* Set bit */
gotoRoom(roomName, 'S');
}
}
/************************************************************************/
/* doSysop() handles the sysop-only menu */
/* return FALSE to fall invisibly into default error msg */
/************************************************************************/
char doSysop(c, first)
char c;
char first; /* first parameter if TRUE */
{
char *netVersion();
label who;
struct logBuffer lBuf;
int logNo, ltabSlot;
if (!onConsole) return TRUE;
while (TRUE) {
mPrintf("\n privileged fn: ");
switch (toUpper( first ? first : iChar() )) {
case 'Z':
mPeek(); break;
case 'E':
mPrintf("cho %sabled\n ", (anyEcho = !anyEcho) ? "en" : "dis");
break;
case 'A':
mPrintf("bort\n ");
return FALSE;
case 'C':
mPrintf("hat mode %sabled\n ",
(cfg.noChat = !cfg.noChat)
?
"dis"
:
"en"
);
break;
case 'D':
cfg.debug = !cfg.debug;
mPrintf("ebug switch=%d\n \n", cfg.debug);
break;
case 'I':
mPrintf("nformation\n ");
mPrintf("Citadel-86 V%s\n Net version %s", VERSION, netVersion());
mPrintf("\n Commands version %d.%d\n ", majorVers(), fixVers());
mPrintf("ctdlcnfg.sys version %d\n ", cfg.paramVers);
break;
case 'K':
mPrintf("ill account\n ");
getNormStr("who", who, NAMESIZE, ECHO);
logNo = findPerson(who, &lBuf);
if (logNo == ERROR) {
mPrintf("No such person\n ");
break;
}
if (lBuf.credit != 0)
mPrintf("%s has %d credit for l-d!", who);
if (!getYesNo("Confirm")) break;
mPrintf(
"%s deleted\n ",
who
);
ltabSlot = PWSlot(lBuf.lbpw, /* load == */ FALSE);
lBuf.lbname[0] = '\0';
lBuf.lbpw[0 ] = '\0';
lBuf.lbflags.L_INUSE = FALSE;
putLog(&lBuf, logNo);
logTab[ltabSlot].ltpwhash = 0;
logTab[ltabSlot].ltnmhash = 0;
break;
case 'M':
mPrintf("\bSystem now on MODEM\n ");
whichIO = MODEM;
setUp(FALSE);
mPrintf("Chat mode %sabled\n ", cfg.noChat ? "dis" : "en");
if (cfg.debug) mPrintf("Debug mode on\n " );
#ifdef NEED_VISIBLE
if (visibleMode) mPrintf("Visible mode on\n ");
#endif
return FALSE;
case 'P':
mPrintf("\baide privilege set/clear\n ");
getNormStr("who", who, NAMESIZE, ECHO);
logNo = findPerson(who, &lBuf);
if (logNo == ERROR) {
mPrintf("No such person\n ");
break;
}
if (lBuf.lbflags.AIDE == 1)
lBuf.lbflags.AIDE = 0;
else
lBuf.lbflags.AIDE = 1;
mPrintf(
"%s %s aide privileges\n ",
who,
(lBuf.lbflags.AIDE == 1) ? "gets" : "loses"
);
if (!getYesNo("Confirm")) break;
putLog(&lBuf, logNo);
/* see if it is us: */
if (loggedIn && strCmpU(logBuf.lbname, who)==SAMESTRING) {
aide = (lBuf.lbflags.AIDE == 1) ? TRUE : FALSE;
logBuf.lbflags.AIDE = (aide) ? TRUE : FALSE;
}
break;
case 'S':
changeDate();
break;
#ifdef NEED_VISIBLE
case 'V':
mPrintf(" VisibleMode==%d\n ", visibleMode = !visibleMode);
break;
#endif
case 'X':
mPrintf("\bexit to MS-DOS\n \n");
ExitToMsdos = TRUE;
exitValue = SYSOP_EXIT;
return FALSE;
case 'N':
netStuff();
break;
case 'R':
mPrintf("einitialize Modem\n ");
modemInit();
break;
case 'Q':
cfg.oldest = getNumber(" Set oldest to", 0, 32000);
break;
case '?':
tutorial("ctdlopt.mnu");
break;
default:
if (!expert) mPrintf(" ?(Type '?' for menu)\n " );
else mPrintf(" ?\n " );
break;
}
}
}
/************************************************************************/
/* doUngoto() handles the Ungoto command */
/************************************************************************/
doUngoto(c, first)
char c;
char first; /* first parameter if TRUE */
{
mPrintf("ngoto\n ");
if (lastRoom == -1) {
mPrintf("No room to Ungoto to!\n ");
return;
}
retRoom();
}
/************************************************************************/
/* getCommand() prints menu prompt and gets command char */
/* Returns: char via parameter and expand flag as value -- */
/* i.e., TRUE if parameters follow else FALSE. */
/************************************************************************/
char getCommand(c)
char *c;
{
char BBSCharReady();
char expand;
outFlag = OUTOK;
givePrompt();
*c = toUpper(iChar());
expand = (
*c == ' '
||
*c == '.'
||
*c == ','
||
*c == '/'
);
if (expand) *c = toUpper(iChar());
if (justLostCarrier) {
justLostCarrier = FALSE;
if (loggedIn) terminate(FALSE);
}
return expand;
}
/************************************************************************/
/* greeting() gives system-entry blurb etc */
/************************************************************************/
greeting()
{
if (loggedIn) terminate(FALSE);
setUp(TRUE); pause(10);
setmem(audit, AUDIT, ' ');
acount = 0;
mPrintf("\n Welcome to %s", cfg.codeBuf + cfg.nodeTitle);
mPrintf("\n Running: Citadel-86 (V%s) \n \n", VERSION);
printDate();
mPrintf("\n H for Help\n ");
printf("Chat mode %sabled\n", cfg.noChat ? "dis" : "en");
printf("\n 'MODEM' mode.\n " );
printf("(<ESC> for CONSOLE mode.)\n " );
while (MIReady())
inp();
gotoRoom(baseRoom, 'R');
}
/************************************************************************/
/* main() contains the central menu code */
/************************************************************************/
main(argc, argv)
int argc;
char **argv;
{
char c, x;
char getCommand();
/* don't put any code above init()... readSysTab() will defeat it. */
cfg.weAre = CITADEL;
initCitadel();
greeting();
if (argc >= 2) {
sPrintf(msgBuf.mbtext,
"System brought up from apparent crash. See header for time it came up.");
aideMessage(FALSE);
}
while (!ExitToMsdos) {
x = getCommand(&c);
outFlag = OUTOK;
if ((c==CNTRLl) ? doSysop(0, '\0') : doRegular(x, c)) {
if (!expert) mPrintf(" ? (Type '?' for menu)\n \n" );
else mPrintf(" ?\n \n" );
}
}
if (loggedIn) terminate( /* hangUp == */ TRUE);
writeSysTab();
exit(exitValue);
}